1. Field of the Invention
Apparatus and methods consistent with the present invention relate to encoding and decoding an image, and more particularly, to a method and apparatus for encoding and decoding an image by using sub-pixel-based motion prediction.
2. Description of the Related Art
In image encoding/decoding methods using motion prediction, e.g., the H.264 video compression standard, motion prediction is performed by intraprediction and interprediction. Intraprediction is a process of reducing spatial redundancy within a single frame. H.264 intraprediction is designed to improve the compression efficiency of intraprediction by performing motion prediction prior to frequency conversion, which is based on an idea that adjacent macroblocks have similar characteristics.
Interprediction is performed on the basis of motion estimation and motion compensation that allow the removal of redundancy between consecutive frames. H.264 interprediction is different from former video compression standards in that it supports motion prediction with a precision of ¼ pixel. Sub-pixel-based motion prediction provides higher compression efficiency than integer-pixel-based motion prediction and the precision of ¼ pixel exhibits better performance than a precision of integer pixel.
FIG. 1 illustrates a relationship between positions of integer pixels and sub-pixels according to the H.264 standard.
Integer pixels are indicated by capital letters and sub-pixels are indicated by small letters. In other words, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, and U indicate integer pixels, b, h, j, m, s, aa, bb, cc, dd, ee, ff, gg, and hh indicate ½ pixels, and a, c, d, e, f, g, i, k, n, p, q, and r indicate ¼ pixels.
The first ½ pixel is sampled by applying 6-tap finite impulse response (FIR) filtering to integer pixels. Once a ¼ pixel is obtained by interpolation between the obtained ½ pixel and an integer pixel, motion prediction uses the ½ pixel and the ¼ pixel, i.e., sub-pixels.
FIG. 2 is a block diagram of an image encoder 200 using motion prediction.
Since a ½ pixel is generated by using 6-tap FIR filtering as mentioned above, the image encoder 200 generates a ½ pixel in a beforehand sub-pixel interpolation unit 210 and stores a frame in units of ½ pixels in a frame storage unit 220. A ¼ pixel is generated by a relatively simple operation such as bilinear filtering of the frame stored in the frame storage unit 220. Thus, a frame in units of ¼ pixels is used for motion prediction performed in a motion estimation unit 240 and a motion-compensated prediction unit 250. Motion information is transmitted in the form of a motion vector for each sub-pixel.